﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;

namespace MethodWorx.CMS.Linq
{
    [Table(Name = "dbo.PublishedPlaceholder")]
    public class LinqPublishedPlaceholder
    {
        private EntityRef<LinqPage> proxyParent;

        public LinqPublishedPlaceholder()
        {
            this.proxyParent = new EntityRef<LinqPage>();
        }

        [Column(IsPrimaryKey = true, UpdateCheck = UpdateCheck.Never)]
        public Guid Id { get; set; }

        [Column(UpdateCheck = UpdateCheck.Never)]
        public Guid PageId { get; set; }

        [Association(IsForeignKey = true, Name = "Parent", OtherKey = "Id", ThisKey = "PageId", Storage = "proxyParent")]
        public LinqPage Page
        {
            get { return this.proxyParent.Entity; }
            set { this.proxyParent.Entity = value; }
        }


        [Column(UpdateCheck = UpdateCheck.Never)]
        public string Name { get; set; }

        [Column(UpdateCheck = UpdateCheck.Never)]
        public string Code { get; set; }
    }
}
